﻿using System.Data;

namespace Tender.Tool.Server.Database
{
    public interface IDatabase
    {
        /// <summary>
        /// 
        /// </summary>
        public DataBaseSelect dataBaseSelect { get; set; }
        /// <summary>
        /// 查询数据返回值 DataTable
        /// </summary>
        /// <param name="sql">SQL语句</param>
        /// <returns></returns>
        public Task<DataTable> Where(string sql);
        /// <summary>
        /// 查询数据返回值 DataTable
        /// </summary>
        /// <param name="sql">SQL语句</param>
        /// <param name="excption">如果有可能则输出错误信息</param>
        /// <returns></returns>
        public DataTable Where(string sql, out string excption);
        /// <summary>
        /// 返回数据实体集合
        /// </summary>
        /// <typeparam name="T">查询实体</typeparam>
        /// <param name="sql">SQL语句</param>
        /// <param name="exception">如果有可能则输出错误信息</param>
        /// <returns></returns>
        public List<T> Where<T>(string sql, out string exception) where T : class, new();
        /// <summary>
        /// 返回数据实体集合
        /// </summary>
        /// <typeparam name="T">查询实体</typeparam>
        /// <param name="sql">SQL语句</param>
        /// <returns></returns>
        public Task<List<T>> Where<T>(string sql) where T : class, new();

    }
}
